package com.example.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.mapper.TeacherMapper;
import com.example.pojo.careerTalk;
import com.example.pojo.teacher;
import com.example.pojo.tracking;
import com.example.pojo.user;
import com.example.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class TeacherServiceImpl implements TeacherService {

    @Autowired
    private TeacherMapper teacherMapper;


    //根据用户名查找管理员
    @Override
    public teacher findByName(String username){
        return teacherMapper.findAdminFormName(username);
    }

    //分页展示用户信息
    @Override
    public IPage<user> findAll(Page<user> userPage){
        return teacherMapper.findAll(userPage);
    }

    //分页展示就业信息
    @Override
    public IPage<tracking> findAllCareerList(Page<tracking> trackingPage){
        return teacherMapper.findAllCareerList(trackingPage);
    }

    //分页展示宣讲会信息
    @Override
    public IPage<careerTalk> findAllTalkList(Page<careerTalk> careerTalkPage){
        return teacherMapper.findAllTalkList(careerTalkPage);
    }

    //查询用户信息(学号)
    @Override
    public IPage<user> findStudentById(String key,Page<user> userPage){
        return teacherMapper.findStudentById(key,userPage);
    }

    //查询用户信息(姓名)
    @Override
    public  IPage<user> findStudentByName(String key,Page<user> userPage){
        return teacherMapper.findStudentByName(key,userPage);
    }

    //管理员端新增用户信息
    @Override
    public void addUser(user u){
        teacherMapper.addUser(u);
    }

    //删除用户信息
    @Override
    public void deleteUser(String id){
        teacherMapper.deleteUser(id);
    }
}
